<template>
  <view class="box">
    <view v-if="userBugInfo.length">
      <scroll-view
        class="scrollY padding20"
        scroll-y="true"
        scroll-with-animation="true"
        @scrolltolower="scrolltolowerFnc"
      >
        <view class="record mb15 padding20" v-for="item in userBugInfo">
          <view class="name"> {{ item.name }} </view>
          <view class="order-num"> {{ item.address }} </view>
          <view class="rcord-footer">
            <view class="date">电话：{{ item.phone }} </view>
            <view class="date-tj"> 体检时间：{{ item.checkTime }} </view>
          </view>
        </view>
        <view v-if="noData" style="text-align: center; color: #aaa">
          没有更多数据了
        </view>
      </scroll-view>
    </view>
    <view class="noneData" v-else>
      <image src="/static/images/noneData.png" mode="widthFix" />
      <text>暂无数据</text>
    </view>
  </view>
</template>

<script>
import { hospitaList } from "@/api/trading.js";

export default {
  data() {
    return {
      userBugInfo: [],
      params: {
        pageNo: 1,
        pageSize: 10,
		status:0
      },
      noData: false,
    };
  },
  onLoad() {
    this.requestJybbusinessorderList();
  },
  methods: {
    back() {
      uni.navigateBack();
    },

    scrolltolowerFnc() {
      if (this.noData) return;
      this.requestJybbusinessorderList();
    },

    requestJybbusinessorderList() {
      uni.showLoading({
        title: "正在加载",
      });
      const params = this.params;
      console.log(params, "----请求数据");
      hospitaList(params)
        .then((res) => {
          const _list = res.result.records || [];
          this.noData = _list.length < this.params.pageSize;
          this.params.pageNo++;
          this.userBugInfo = [...this.userBugInfo, ..._list];
          uni.hideLoading();
        })
        .catch((res) => {
          this.$util.Tips({
            title: res,
          });
          uni.hideLoading();
        });
    },
  },
};
</script>

<style lang="scss" scoped>
@import url("../../static/css/gstyle.scss");

.box {
  .scrollY {
    height: calc(100vh - 44px);
  }
}

.record {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: white;
  box-shadow: $box-shadow;
  border-radius: $uni-border-radius-lg;
  background: #e2e8ce;

  .name {
    font-size: 30rpx;
  }

  .order-num {
    font-size: 22rpx;
    color: #818181;
    margin: 20rpx 0;
  }

  .rcord-footer {
    display: flex;
    justify-content: space-between;

    .date {
      font-size: 22rpx;
      color: #818181;
    }

    .label {
      flex: 1;
      font-size: 26rpx;
    }

    .date-tj {
      font-size: 25rpx;
    }
  }
}
</style>
